import { Injectable } from '@angular/core';

import { Observable } from 'rxjs/Observable';
import 'rxjs/add/observable/of';
import 'rxjs/add/operator/do';
import 'rxjs/add/operator/delay';

// services
import { ConstantService } from './constant.service';
import { StorageService } from './storage.service';

@Injectable()
export class AuthService {
    // store the URL so we can redirect after logging in
    redirectUrl: string;

    constructor(
        private constant: ConstantService,
        private storage: StorageService
    ) { }

    isLoggedIn(): boolean {
        const token = this.storage.getItem(this.constant.storage.token);
        return token ? true : false;
    }
}